﻿// -----------------------------------------------------------------------
// <copyright file="Enemy.cs" company="Diddly Squad">
// </copyright>
// -----------------------------------------------------------------------

using Microsoft.Xna.Framework;

namespace DiddlySquat
{
	/// <summary>
	/// Small enemy class. This enemy can jump.
	/// </summary>
	public class SmallIdiot : Enemy
	{
		//private System.Random generator;

		public SmallIdiot()
		{
			this.EnemySprite = Constants.SmallIdiotSprite;
			this.SizeFactor = Constants.SmallIdiotSizeFactor;
			this.EnemyRestitution = Constants.SmallIdiotRestitution;
			this.EnemyFriction = Constants.SmallIdiotFriction;
			this.Damage = Constants.SmallIdiotDamage;
			this.EnemyType = Enums.EnemyType.SmallIdiot;
			this.Speed = Constants.SmallIdiotSpeed;
			this.MaxSpeed = Constants.SmallIdiotMaxSpeed;
			this.Range = Constants.SmallIdiotRange;
			this.MaxJumps = Constants.SmallIdiotMaxJumps;
			this.JumpStrength = Constants.SmallIdiotJumpStrength;
		}

		/// <summary>
		/// Updates the enemy and moves towards target.
		/// </summary>
		/// <param name="gameTime">The game time.</param>
		/// <param name="target">The target.</param>
		public override void Update(GameTime gameTime, Character target)
		{
			this.Jump();
			base.Update(gameTime, target);
		}

		/// <summary>
		/// Can character still jump.
		/// </summary>
		/// <returns>
		/// True if can, False if can't
		/// </returns>
		public override bool ReadyToJump()
		{
			int rand = Utils.GetRandomInteger(100);
			
			if (rand == 1)
			{
				if (this.JumpsLeft > 0)
					return true;
			}
			return false;
		}
	}
}